﻿/**
 * Create in 2012-4-3.
 */
package kit4j.tests.jdk.awt;

import java.awt.Frame;
import java.awt.Window;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;

/**
 * 
 * @author MiniKnife
 *
 */
public class TestTaskBarWithWindow {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		getWindow().setVisible(true);
		getFrame().setVisible(true);
	}
	
	static Window getWindow() {
		final Window wd = new Window(null);
		
		wd.setSize(400, 400);
		wd.setLocation(50, 50);
		wd.addWindowFocusListener(new WindowAdapter() {
			@Override
			public void windowGainedFocus(WindowEvent evt) {
				wd.setVisible(false);
			}
		});
		
		return wd;
	}
	
	static Frame getFrame() {
		final Frame frame = new Frame();
		
		frame.setSize(400, 400);
		frame.setLocation(700, 50);
		frame.addWindowListener(new WindowAdapter() {
			@Override
			public void windowClosing(WindowEvent evt) {
				frame.setVisible(false);
			}
		});
		
		return frame;
	}

}
